home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4884 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: news.iadfw.net!usenet
  2. From: Mark Nelson <markn@airmail.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Interrupts in C++
  5. Date: Thu, 01 Feb 1996 08:40:38 -0600
  6. Organization: customer of Internet America
  7. Message-ID: <3110D0E6.3198@airmail.net>
  8. References: <310FBF6A.6692@sask.aecl.ca>
  9. NNTP-Posting-Host: dal03-17.ppp.iadfw.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. Mark Kotyk wrote:
  16. > I've been trying to get a good Com class going, but soon found
  17. > out there is no easy way to get a Dos interrupt handler to sit
  18. > in a class, and have access to private data members.
  19. > Any help.  I have picked up a package that did allow interrupts
  20. > to be created dynamically, but it was rather large.
  21.  
  22. Using a member function as an interrupt handler usually isn't going to work. 
  23. A better way is to just pick up a pointer to a class inside your ISR;
  24.  
  25. void _interrupt isr(...)
  26. {
  27.    COM *c;
  28.    c = com_objects[ i ]; //or whatever
  29.    id = inp( c->iir );
  30.  
  31. I used this technique in my book on C++ serial communiations.  You can get 
  32. more info about it from my home page.
  33.  
  34. Mark Nelson
  35. http://web2.airmail.net/markn
  36.